using System;
using System.Collections.Generic;
using Castle.ActiveRecord;

namespace Library.Core.Model
{
    [ActiveRecord(Lazy = true)]
    public class Product
    {
        [PrimaryKey(PrimaryKeyType.Native, ColumnType = "Int64")]
        public virtual long Id { get; set; }

        [Property(ColumnType = "String", Length = 64)]
        public virtual string Name { get; set; }

        [Property(ColumnType = "String", Length = 256)]
        public virtual string Description { get; set; }

        [Property(ColumnType = "Decimal")]
        public virtual decimal Price { get; set; }

        [Property(ColumnType = "Boolean")]
        public virtual bool IsDisponible { get; set; }

        [BelongsTo]
        public virtual ProductCategory Category { get; set; }

        [HasAndBelongsToMany(typeof (Customer), ColumnRef = "IdCustomer", ColumnKey = "IdProduct", Lazy = true,
            Table = "CustomerProduct")]
        public virtual IList<Customer> Customers { get; set; }
    }
}
